<template>
<NuxtLayout name="index">
  <div>
    <div>  {{state.loading}} 付该减肥地方更好地发挥的is的故事的故事从V型从发鬼地方个的fghfghfghf</div>
    <button  @click="ok()">dddd</button>
    <button  @click="oaa()">ddddhhhhh</button>
    <div>111115555555恢复规划法国恢复</div>
    <NuxtLink to="/indexe">Home page恢复规划</NuxtLink>
  </div>
</NuxtLayout>
</template>


<script>

// export default {
//   name: 'Indexxx',
//   head: {
//     title: 'K.fghfghfghfgh'
//   },
// };
</script>
<script setup>
  import axios from "axios";
//  import { reactive,ref } from 'vue';


    useMeta({
      title:'dfgdfgd'
    });

// const { $axPost } = useNuxtApp()
//   await $axPost('/api/pc/get_company_info').then((data)=>{
//   console.log(data)
// }).catch(err=>{
//   console.log(err)
// })

// await $useFetch('/api/pc/get_company_info').then((data)=>{
//   console.log(data)
// }).catch(err=>{
//   console.log(err)
// })
  

    const state = reactive({
      loading: 0,
    });
    // const { data } = await useAsyncData('count', () => $fetch('/api/index'))
    const dynamicForm = ref(1);
    const res = ref(null);


const getArticles = (async () => {
      try {
        const response = await axios.get(
          "https://jsonplaceholder.typicode.com/posts?_limit=10"
        );
        res.value = await response.data;
        console.log('res.value', await response.data);
      } catch (error) {
        console.log(error);
      }
    })();


    const ok =  async () => {
      const { data }  = await useAsyncData('index', () => $fetch('/api/index'))
      console.log(data)
      dynamicForm.value = data.value;
    };
    ok()

    async function oaa() {
      const { data } = await useAsyncData('count', () => $fetch('/api/index'))
      console.log(data)
      state.loading = data
    }


// const [{ data: organization }, { data: repos }] = await Promise.all([
//       useFetch(`https://api.github.com/orgs/nuxt`),
//       useFetch(`https://api.github.com/orgs/nuxt/repos`)
//     ])
//     console.log(organization)

</script>